<?php
declare (strict_types = 1);
namespace app\user\service\user;

use app\common\service\BaseService;
use think\db\exception\DbException;
use think\facade\Request;
use app\user\logic\user\Coupon as CouponLogic;

/**
 * 用户卡券接口类
 */
class Coupon extends BaseService
{

    /**
     * @throws DbException
     */
    public function list(string $type)
    {
        $data = app(CouponLogic::class)->list($type);

        return $this->parseToData($data, 1, '获取成功');
    }

    public function exchange()
    {
    	$param = Request::post();
    	$data  = app(CouponLogic::class)->exchange($param);

        return $this->parseToData($data, 1, '兑换成功');
    }
}
